
<template>
  <component
    v-if="element"
    ref="ComponentRef"
    :is="element.type + '-widget-render'"
    :element="element"
    :key="index"
  ></component>
</template>
 
<script lang="ts">
import { defineComponent, toRefs } from "vue";
import {
  cardWidget,
  formWidget,
  rowWidget,
  dialogWidget,
} from "../pc-library/index";

export default defineComponent({
  props: ["element", "parent", "index"],
  components: {
    cardWidgetRender: cardWidget,
    formWidgetRender: formWidget,
    rowWidgetRender: rowWidget,
    dialogWidgetRender: dialogWidget,
  },
  setup(props) {

    const { element, parent } = toRefs(props);
    return {
      element,
      parent,
    };
  },
});
</script>

<style  scoped>
</style>
